<?php
	$loi = "";
	if(isset($_POST["ok"])){
		$u = $p = "";
		if($_POST["user"] == ""){
			$loi[] = "Ban nhap thieu Username";
		}else{
			$u = $_POST["user"];
		}
		if($_POST["pass"] == ""){
			$loi[] = "Ban nhap thieu Password";
		}else{
			$p = $_POST["pass"];
		}
		$lev = $_POST["lev"];
		if($u && $p && $lev){
			$add = new muser();
			$add->setuser($u);
			$add->setpass($p);
			$add->setlevel($lev);
			if($add->add_user() == false){
				$loi[] = "Username da ton tai";
			}else{
				$add->add_user();
				header("location:index.php?module=listuser&action=list");
				exit();
			}
		}
	}
	
?>
<?php
	require ("views/user/vadd_user.php");
?>